
package sisi;

import java.util.Map;

import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.ConventionWires;
import org.zkoss.zul.Window;

import sisi.login.LoginController;

/**
 * @author Pedro Gonzalez pedro@sisisoftware.it
 * @author Claudio Pelosi claudio@sisisoftware.it
 * @author SISI Software S.n.c. - www.sisisoftware.it
 * @version 1.0
 * 
 */
@SuppressWarnings("serial")
public class IndexWindow extends Window implements
		org.zkoss.zk.ui.ext.AfterCompose {
	private Window indexWindow;

	protected Map<String, Object> args;

	public void onCreate$indexWindow(Event event) {
		
			if (new LoginController().LoginVerifica() != 0){
				Window finestraLogin = (Window) Executions.createComponents(
						"/login.zul", null, null);
				finestraLogin.doModal();
			}

			String utente;
			utente = (String) Sessions.getCurrent().getAttribute("utente");
			indexWindow.setTitle("Data Studio Sistemi S.r.l. - Utente: " + utente);
			
			// adesso dovremo prendere i valori di come creare il menu
			indexWindow.setVisible(true);
	}
	

	public void afterCompose() {
		// wire variables
		ConventionWires.wireVariables(this, this);
		// auto forward
		ConventionWires.addForwards(this, this);
		
	}

}
